package com.xpd.spring.aop;

import org.aspectj.weaver.ast.Var;

public class Demo {
    public static void main(String[] args) {
        Person p1=new fangdong();
        Person p2=new zhongjie(p1);
      p2.say();
    }


}
interface Person{
     void say();
}
class fangdong implements Person{

    @Override
    public void say() {
        System.out.println("我有一套好房子");
    }
}
class zhongjie implements Person{
private Person person;
//代理主题要有对被代理主题的引用
    public zhongjie(Person person){
        this.person=person;
    }
    public void say() {
        System.out.println("交通便利");
        person.say();
        System.out.println("靠大海");
    }

}
